package com.active.test.spring;

import lombok.extern.slf4j.Slf4j;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.stereotype.Service;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2019-11-26 下午4:11
 */
@Slf4j
@Service
public class SpringMQ_Consumer {
    @Autowired
    private JmsTemplate jmsTemplate;

    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("application.xml");
        final SpringMQ_Consumer consumer = ctx.getBean(SpringMQ_Consumer.class);
        final String message = (String) consumer.jmsTemplate.receiveAndConvert();
        log.info("receive msg {}", message);
    }
}
